// 1002.cpp : Defines the entry point for the console application.
//
#include <iostream>
using namespace std;

#define MAX_COUNT 1000

class Q
{
	struct E
	{
		int w;
		int s;
	};

	E ES[MAX_COUNT]; //Request
	bool G[MAX_COUNT][MAX_COUNT]; //Graph
	int P[MAX_COUNT]; //Prev
	int F[MAX_COUNT]; //Cache
	int c;
	
	int dp( int n )
	{
		if( F[n] != 0 ) return F[n];

		int max = 0;
		int prev = 0;
		for( int i = 0; i < c; i++ )
		{
			if( i != n && G[n][i] )
			{
				int r = dp( i );
				if( max < r )
				{
					max = r;
					prev = i + 1;
				}
			}
		}

		P[n] = prev;
		F[n] = max + 1;
		return max + 1;
	}

public:
	Q()
	{
		memset( F, 0, sizeof( F ) );
		c = 0;
		while( 1 )
		{
			E& e = ES[c];
			if( !( cin >> e.w >> e.s ) )
			{
				break;
			}
			for( int i = 0; i < c; i++ )
			{
				G[c][i] = ( e.w < ES[i].w ) && ( e.s > ES[i].s );
				G[i][c] = ( ES[i].w < e.w ) && ( ES[i].s > e.s );
			}
			c++;
		}
	}

	void PAO() // Process and Output
	{
		int max = -1;
		int prev = 0;
		for( int i = 0; i < c; i++ )
		{
			int r = dp( i );
			if( max < r )
			{
				max = r;
				prev = i + 1;
			}
		}

		cout << max << endl;
		while( prev != 0 )
		{
			cout << prev << endl;
			prev = P[prev - 1];
		}
	}
};

int main( int agrc, char* argv[] )
{
	Q().PAO();
	return 0;
}
